<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .animate{
            width: 100px;
            height: 100px;
            background: #cccccc;
            transition: width 3s;
            
        }
    </style>
</head>
<body>
    <div class="animate" id="box"></div>
    <script>
        let animate = document.querySelector('.animate');
        animate.onclick = function(){
            animate.style.width = '300px';
        }
    </script>
</body>
</html>